package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 理赔状态描述
 * @Author WJH
 * @Date 2021/10/21
 */
public enum ClaimsStatus {
    INIT(0, "未理赔"),
    PROCESSING(1, "理赔审核中"),
    SUCCESS(2, "理赔审核通过"),
    FAILURE(3, "理赔审核拒绝"),
    CANCEL(4, "客户取消理赔"),
    NO_PASSED(5, "审核不通过"),
    ;

    ClaimsStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    private int status;
    private String desc;

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static ClaimsStatus resolve(int status){
        return Arrays.stream(values()).filter(s -> s.status == status).findFirst().orElseThrow(() -> new RuntimeException("未识别的理赔状态[" + status + "]"));
    }


    @Override
    public String toString() {
        return String.format("%s:%s", status, desc);
    }
}
